[XEN][POWERPC] boot_of_allocator fixups
authorJimi Xenidis <jimix@watson.ibm.com>
Tue, 12 Dec 2006 01:50:32 +0000 (20:50 -0500)
committerJimi Xenidis <jimix@watson.ibm.com>
Tue, 12 Dec 2006 01:50:32 +0000 (20:50 -0500)
This patch:
  - print devtree mod size correctly
  - find next_bit rather then test all needed bits to be zero
  - stop pre-allocating memory below image as used
Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
--HG--
extra : transplant_source : %88%7E%1C%BA%C6%15M%A0%A3%A3%C2C%3F%BC%5B%0F%C2%A1%C9%B8

xen/arch/powerpc/boot_of.c

index f5d456bf047775f9e0d1c490cde249f9698241d1..8f66c65155d03df2fb305ad6300c2fa248585f86 100644 (file)
@@ -431,19 +431,8 @@ static void boot_of_alloc_init(int m, uint addr_cells, uint size_cells)
         }
     }
 
-    /* FW is incorrect in that the space below our image is not safe
-     * either */
-    start = (ulong)_start >> PAGE_SHIFT;
-    pg = 0;
-    DBG("%s: marking 0x%x - 0x%lx\n", __func__,
-        pg << PAGE_SHIFT, start);
-    while (pg < start - 1) {
-        set_bit(pg, mem_available_pages);
-        ++pg;
-    }
-        
     /* Now make sure we mark our own memory */
-    pg = start;
+    pg =  (ulong)_start >> PAGE_SHIFT;
     start = (ulong)_end >> PAGE_SHIFT;
 
     DBG("%s: marking 0x%x - 0x%lx\n", __func__,
@@ -521,11 +510,8 @@ static ulong boot_of_alloc(ulong size)
         /* find a set that fits */
         DBG("%s: checking for 0x%lx bits: 0x%lx\n", __func__, bits, pos);
 
-        i = 1;
-        while (i < bits && !test_bit(pos + i, mem_available_pages))
-            ++i;
-
-        if (i == bits) {
+        i = find_next_bit(mem_available_pages, MEM_AVAILABLE_PAGES, pos);  
+        if (i - pos >= bits) {
             uint addr = pos << PAGE_SHIFT;
 
             /* make sure OF is happy with our choice */
@@ -1073,7 +1059,7 @@ static void * __init boot_of_devtree(module_t *mod, multiboot_info_t *mbi)
 
     mod->mod_start = (ulong)oft;
     mod->mod_end = mod->mod_start + oft_sz;
-    of_printf("%s: devtree mod @ 0x%016x[0x%x]\n", __func__,
+    of_printf("%s: devtree mod @ 0x%016x - 0x%016x\n", __func__,
               mod->mod_start, mod->mod_end);
 
     return oft;
@@ -1152,7 +1138,6 @@ static void * __init boot_of_module(ulong r3, ulong r4, multiboot_info_t *mbi)
         ++mod;
 
     oft = boot_of_devtree(&mods[mod], mbi);
-    of_printf("hello\n");
     if (oft == NULL)
         of_panic("%s: boot_of_devtree failed\n", __func__);